package com.openxt.nbzj.model;

import android.content.Context;

import com.openxt.nbzj.util.SystemUtil;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

/**
 * Created by 颖杰_2 on 2016/7/7.
 */
public class ConfigModel {

    /**天气接口*/
    public final static String WEATHER_GETWEATHER = "$weather_getweather$";
    /**拥堵指数接口*/
    public final static String WEATHER_GETTRAFFICJAM = "$weather_gettrafficjam$";
    /**活动图片*/
    public final static String ACTIVITY_GET = "$activity_get$";
    /**热点新闻*/
    public final static String NEWS_GETHOT = "$news_gethot$";
    /**订阅列表-首页*/
    public final static String SUBSCRIBE_HOME = "$subscribe_home$";
    /**登录*/
    public final static String LOGIN_NATIVE = "$login_native$";
    /**登录*/
    public final static String LOGIN_USERNAME = "$login_username$";
    /**登录*/
    public final static String LOGIN_PASSWORD = "$login_password$";
    /**专题*/
    public final static String SPECIAL_GET_NATIVE = "$special_get_native$";
    /**订阅提交*/
    public final static String SUBSCRIBE_SUBMIT = "$subscribe_submit$";
    /**获取新闻类型*/
    public final static String NEWS_GETALLNEWSTYPE = "$news_getallnewstype$";
    /**获取新闻大图数据*/
    public final static String NEWS_GETNATIVECATEGORYBIGIMG = "$news_getnativecategorybigimg$";
    /**获取新闻数据*/
    public final static String NEWS_GETNATIVECATEGORYDATANEW = "$news_getnativecategorydata$";
    /**获取新闻数据*/
    public final static String NEWS_GETNATIVEFINDNEWS = "/News/GetNativeFindNews";
    /**企业资质*/
    public final static String ENTERPRISE_GETNATIVE = "$enterprise_getnative$";
    /**企业信用*/
    public final static String ENTERPRISE_GETNATIVE_CREDIT = "$enterprise_getnative_credit$";
    /**企业信用分类*/
    public final static String ENTERPRISE_GETALLENTTYPE = "$enterprise_getallenttype$";
    /**企业信用分页*/
    public final static String ENTERPRISE_GETPAGENATIVE_CREDIT = "$enterprise_getpagenative_credit$";
    /**企业信用详情*/
    public final static String ENTERPRISE_GETCREDIT_DETAIL = "$enterprise_getcredit_detail$";
    /**项目信息*/
    public final static String PROJECT_GETNATIVE = "$project_getnative$";
    /**企业资质详情*/
    public final static String ENTERPRISE_GETINFO = "$enterprise_getinfo$";
    /**项目详情*/
    public final static String PROJECT_GETINFO = "$project_getinfo$";
    /**建委公文*/
    public final static String PUSHNOTICE_GETNATIVEPAGEPUSHNOTICE = "$pushnotice_getnativepagepushnotice$";
    /**建委公文详情*/
    public final static String PUSHNOTICE_GETPUSHNOTICE = "$pushnotice_getpushnotice$";
    /**建委公文详情状态*/
    public final static String PUSHNOTICE_HASREAD = "$pushnotice_hasread$";
    /**获取版本更新*/
    public final static String CHECKVERSION = "$checkversion$";
    /**房屋巡查*/
    public final static String HOUSEPATROL_GETPATROLTASK_NATIVE = "$housepatrol_getpatroltask_native$";
    /**通知公告*/
    public final static String NOTICE_GETNATIVE = "$notice_getnative$";
    /**公告收藏*/
    public final static String NOTICE_GETNATIVECOLLECT = "$notice_getnative_collect$";
    /**心跳*/
    public final static String HEARTBEAT_CALL = "$heartbeat_call$";
    /**页面访问量统计*/
    public final static String ACCESSSTATISTICS_CALL = "$accessstatistics_call$";
    /**通知公告详情*/
    public final static String NOTICE_GET = "$notice_get$";
    /**通知公告详情-获取是否收藏*/
    public final static String NOTICE_GETCOLLECT = "$notice_getcollect$";
    /**通知公告详情-取消收藏*/
    public final static String NOTICE_DELCOLLECT = "$notice_delcollect$";
    /**通知公告详情-添加收藏*/
    public final static String NOTICE_COLLECTIONNOTICE = "$notice_collectionnotice$";
    /**修改头像*/
    public final static String CUSTOMER_UPTIMAGE = "$customer_uptimage$";
    /**修改昵称*/
    public final static String CUSTOMER_UPDATENICKNAME = "$customer_updatenickname$";

    public final static String ROOTPATH = "ZJWAPP/";

    /**页面动作*/
    public final static String NATIVE_PAGENAME = "$native_pagename$";
    /**首页是否重新装载*/
    public final static String HOME_LOADING = "$home_loading$";
    /**记住密码*/
    public final static String REMEMBER_PASSWORD = "$remember_password$";
    /**踢出事件key*/
    public final static String APP_NOTIFIY_KICKOUT = "$app_notifiy_kickout$";
    /**分享内容*/
    public final static String SHARE_CONTENT = "$share_content$";
    /***原生页面*/
    public static List<String> NATIVE_LIST = new ArrayList<>();
    static {
        /**首页*/
        NATIVE_LIST.add("#/");
        /**登录*/
        NATIVE_LIST.add("#/login");
        /**订阅*/
        NATIVE_LIST.add("#/morder");
        /**专题*/
        NATIVE_LIST.add("#/special");
        /**个人中心*/
        NATIVE_LIST.add("#/center");
        /**新闻资讯列表*/
        NATIVE_LIST.add("#/newslist");
        /**企业资质*/
        NATIVE_LIST.add("#/enterprice");
        /**企业信用*/
        NATIVE_LIST.add("#/enterpricecredit");
        /**项目信息*/
        NATIVE_LIST.add("#/project");
        /**通知公告*/
        NATIVE_LIST.add("#/noticelist");
        /**建委公文*/
        NATIVE_LIST.add("#/jwgw");
    }

    private static Map<Long, JSONObject> mMap = null;
    public static Map<Long, JSONObject> getSubscribes(Context mContext){
        if(mMap == null){
            mMap = new HashMap<>();
            JSONArray array = SystemUtil.getSubscribeList(mContext);
            for(int i = 0, j = array.size(); i < j; i++){
                JSONObject item = array.getJSONObject(i);
                mMap.put(item.getLong("ID"), item);
            }
        }

        return mMap;
    }
}
